package com.easipass.epug.common;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Created by Wangxuyang on 16/6/6.
 */
public class ApplicationContextFactory {
    private static ApplicationContext context = null;


    private ApplicationContextFactory()
    {
        super();
    }

    public static void init()
    {
        String [] contextFileNames = new String [1];
        contextFileNames[0] =  "conf/spring-hibernate.xml";
        context = new ClassPathXmlApplicationContext(contextFileNames);
    }

    public static ApplicationContext getInstance()
    {
        if (null == context)
        {
            init();
        }
        return context;
    }
}
